﻿<%@ Page Language="C#" MasterPageFile="~/aspnet/admin/ForValidation.master" AutoEventWireup="true" CodeFile="CX_Vote_Manage.aspx.cs" Inherits="aspnet_admin_bock_Vote_CX_Vote_Manage" Title="投票管理" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<table align="center" border="0" cellpadding="2" cellspacing="1" class="border"
        height="116" width="100%">
        <tr>
            <td align="center" class="topbg" colspan="2" style="height: 30px">
                <strong>投票管理</strong></td>
        </tr>
        <tr>
            <td class="tdbg" style="width: 223px; height: 27px">
                提示信息:</td>
            <td class="tdbg" style="width: 787px; height: 27px">
                <asp:Label ID="tt" runat="server" CssClass="font-4">欢迎使用</asp:Label>
                            </td>
        </tr>
    </table>
 
 
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConflictDetection="CompareAllValues" 
        ConnectionString="<%$ ConnectionStrings:SqlConn %>" 
        DeleteCommand="DELETE FROM [CX_Vote] WHERE [CX_Vote_id] = @original_CX_Vote_id AND [CX_Vote_Name] = @original_CX_Vote_Name AND [CX_Vote_LX] = @original_CX_Vote_LX AND [CX_Vote_Sort] = @original_CX_Vote_Sort AND [CX_Vote_PublicTime] = @original_CX_Vote_PublicTime" 
        InsertCommand="INSERT INTO [CX_Vote] ([CX_Vote_Name], [CX_Vote_LX], [CX_Vote_Sort], [CX_Vote_PublicTime]) VALUES (@CX_Vote_Name, @CX_Vote_LX, @CX_Vote_Sort, @CX_Vote_PublicTime)" 
        OldValuesParameterFormatString="original_{0}" 
        SelectCommand="SELECT * FROM [CX_Vote] WHERE ([CX_Vote_id] = @CX_Vote_id)" 
        
        UpdateCommand="UPDATE CX_Vote SET CX_Vote_Name = @CX_Vote_Name, CX_Vote_LX = @CX_Vote_LX, CX_Vote_Sort = @CX_Vote_Sort, CX_Vote_PublicTime = @CX_Vote_PublicTime WHERE (CX_Vote_id = @original_CX_Vote_id)">
                        <SelectParameters>
                            <asp:controlparameter ControlID="GridView1" DefaultValue="6666666666" 
                                Name="CX_Vote_id" PropertyName="SelectedValue" Type="Decimal" />
                        </SelectParameters>
                        <deleteparameters>
                            <asp:parameter Name="original_CX_Vote_id" Type="Decimal" />
                            <asp:parameter Name="original_CX_Vote_Name" Type="String" />
                            <asp:parameter Name="original_CX_Vote_LX" Type="Int32" />
                            <asp:parameter Name="original_CX_Vote_Sort" Type="Int32" />
                            <asp:parameter Name="original_CX_Vote_PublicTime" Type="DateTime" />
                        </deleteparameters>
                        <updateparameters>
                            <asp:parameter Name="CX_Vote_Name" Type="String" />
                            <asp:parameter Name="CX_Vote_LX" Type="Int32" />
                            <asp:parameter Name="CX_Vote_Sort" Type="Int32" />
                            <asp:parameter Name="CX_Vote_PublicTime" Type="DateTime" />
                            <asp:parameter Name="original_CX_Vote_id" Type="Decimal" />
                        </updateparameters>
                        <insertparameters>
                            <asp:parameter Name="CX_Vote_Name" Type="String" />
                            <asp:parameter Name="CX_Vote_LX" Type="Int32" />
                            <asp:parameter Name="CX_Vote_Sort" Type="Int32" />
                            <asp:parameter Name="CX_Vote_PublicTime" Type="DateTime" />
                        </insertparameters>
    </asp:SqlDataSource>
                    <br /><table align="center" border="0" cellpadding="2" cellspacing="1" class="border"
        height="116" width="100%">
        <tr>
            <td align="center" class="topbg" colspan="2" style="height: 30px">
                添加新选项</td>
        </tr>
        <tr>
            <td class="tdbg" style="width: 223px; height: 27px">
                添加信息<asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                    ConflictDetection="CompareAllValues" 
                    ConnectionString="<%$ ConnectionStrings:SqlConn %>" 
                    DeleteCommand="DELETE FROM [CX_Vote] WHERE [CX_Vote_id] = @original_CX_Vote_id AND [CX_Vote_Name] = @original_CX_Vote_Name AND [CX_Vote_LX] = @original_CX_Vote_LX AND [CX_Vote_Sort] = @original_CX_Vote_Sort AND [CX_Vote_PublicTime] = @original_CX_Vote_PublicTime" 
                    InsertCommand="INSERT INTO [CX_Vote] ([CX_Vote_Name], [CX_Vote_LX], [CX_Vote_Sort], [CX_Vote_PublicTime]) VALUES (@CX_Vote_Name, @CX_Vote_LX, @CX_Vote_Sort, @CX_Vote_PublicTime)" 
                    OldValuesParameterFormatString="original_{0}" 
                    SelectCommand="SELECT top 0 * FROM [CX_Vote]" 
                    UpdateCommand="UPDATE [CX_Vote] SET [CX_Vote_Name] = @CX_Vote_Name, [CX_Vote_LX] = @CX_Vote_LX, [CX_Vote_Sort] = @CX_Vote_Sort, [CX_Vote_PublicTime] = @CX_Vote_PublicTime WHERE [CX_Vote_id] = @original_CX_Vote_id AND [CX_Vote_Name] = @original_CX_Vote_Name AND [CX_Vote_LX] = @original_CX_Vote_LX AND [CX_Vote_Sort] = @original_CX_Vote_Sort AND [CX_Vote_PublicTime] = @original_CX_Vote_PublicTime">
                    <DeleteParameters>
                        <asp:parameter Name="original_CX_Vote_id" Type="Decimal" />
                        <asp:parameter Name="original_CX_Vote_Name" Type="String" />
                        <asp:parameter Name="original_CX_Vote_LX" Type="Int32" />
                        <asp:parameter Name="original_CX_Vote_Sort" Type="Int32" />
                        <asp:parameter Name="original_CX_Vote_PublicTime" Type="DateTime" />
                    </DeleteParameters>
                    <UpdateParameters>
                        <asp:parameter Name="CX_Vote_Name" Type="String" />
                        <asp:parameter Name="CX_Vote_LX" Type="Int32" />
                        <asp:parameter Name="CX_Vote_Sort" Type="Int32" />
                        <asp:parameter Name="CX_Vote_PublicTime" Type="DateTime" />
                        <asp:parameter Name="original_CX_Vote_id" Type="Decimal" />
                        <asp:parameter Name="original_CX_Vote_Name" Type="String" />
                        <asp:parameter Name="original_CX_Vote_LX" Type="Int32" />
                        <asp:parameter Name="original_CX_Vote_Sort" Type="Int32" />
                        <asp:parameter Name="original_CX_Vote_PublicTime" Type="DateTime" />
                    </UpdateParameters>
                    <InsertParameters>
                        <asp:parameter Name="CX_Vote_Name" Type="String" />
                        <asp:parameter Name="CX_Vote_LX" Type="Int32" />
                        <asp:parameter Name="CX_Vote_Sort" Type="Int32" />
                        <asp:parameter Name="CX_Vote_PublicTime" Type="DateTime" />
                    </InsertParameters>
                </asp:SqlDataSource>
                            </td>
            <td class="tdbg" style="width: 787px; height: 27px">
                <asp:DetailsView ID="DetailsView2" runat="server" AutoGenerateRows="False" 
                    BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" 
                    CellPadding="3" DataKeyNames="CX_Vote_id" DataSourceID="SqlDataSource3" 
                    Height="50px" Width="100%" DefaultMode="Insert" HorizontalAlign="Left" 
                    oniteminserted="DetailsView2_ItemInserted">
                    <FooterStyle BackColor="White" ForeColor="#000066" />
                    <rowstyle forecolor="#000066" />
                    <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                    <fields>
                        <asp:boundfield DataField="CX_Vote_id" HeaderText="CX_Vote_id" InsertVisible="False" 
                            ReadOnly="True" SortExpression="CX_Vote_id"></asp:boundfield>
                        <asp:boundfield DataField="CX_Vote_Name" HeaderText="标题" 
                            SortExpression="CX_Vote_Name"></asp:boundfield>
                        <asp:templatefield HeaderText="票数" SortExpression="CX_Vote_LX">
                            <edititemtemplate>
                                <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("CX_Vote_LX") %>'></asp:TextBox>
                            </edititemtemplate>
                            <insertitemtemplate>
                                <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("CX_Vote_LX") %>'>0</asp:TextBox>
                            </insertitemtemplate>
                            <itemtemplate>
                                <asp:Label ID="Label2" runat="server" Text='<%# Bind("CX_Vote_LX") %>'></asp:Label>
                            </itemtemplate>
                        </asp:templatefield>
                        <asp:templatefield HeaderText="排序" SortExpression="CX_Vote_Sort">
                            <edititemtemplate>
                                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("CX_Vote_Sort") %>'></asp:TextBox>
                            </edititemtemplate>
                            <insertitemtemplate>
                                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("CX_Vote_Sort") %>'>0</asp:TextBox>
                            </insertitemtemplate>
                            <itemtemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# Bind("CX_Vote_Sort") %>'></asp:Label>
                            </itemtemplate>
                        </asp:templatefield>
                        <asp:templatefield ShowHeader="False">
                            <insertitemtemplate>
                       
                                <asp:Button ID="Button1" CausesValidation="True" 
                                    CommandName="Insert"  runat="server" Text="添加数据"  CssClass="btn"/>
                            
                            </insertitemtemplate>
                            <itemtemplate>
                                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                    CommandName="New" Text="New"></asp:LinkButton>
                            </itemtemplate>
                        </asp:templatefield>
                    </fields>
                    <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                </asp:DetailsView>
                            </td>
        </tr>
    </table>
                <br />
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:SqlConn %>" 
        
        SelectCommand="SELECT CX_Vote_id, CX_Vote_Name, CX_Vote_LX, CX_Vote_Sort, CX_Vote_PublicTime FROM CX_Vote ORDER BY CX_Vote_id DESC" ConflictDetection="CompareAllValues" 
                        DeleteCommand="DELETE FROM [CX_Vote] WHERE [CX_Vote_id] = @original_CX_Vote_id " 
                        InsertCommand="INSERT INTO [CX_Vote] ([CX_Vote_Name], [CX_Vote_LX], [CX_Vote_Sort], [CX_Vote_PublicTime]) VALUES (@CX_Vote_Name, @CX_Vote_LX, @CX_Vote_Sort, @CX_Vote_PublicTime)" 
                        OldValuesParameterFormatString="original_{0}" 
                        
        UpdateCommand="UPDATE [CX_Vote] SET [CX_Vote_Name] = @CX_Vote_Name, [CX_Vote_LX] = @CX_Vote_LX, [CX_Vote_Sort] = @CX_Vote_Sort, [CX_Vote_PublicTime] = @CX_Vote_PublicTime WHERE [CX_Vote_id] = @original_CX_Vote_id AND [CX_Vote_Name] = @original_CX_Vote_Name AND [CX_Vote_LX] = @original_CX_Vote_LX AND [CX_Vote_Sort] = @original_CX_Vote_Sort AND [CX_Vote_PublicTime] = @original_CX_Vote_PublicTime">
        <DeleteParameters>
            <asp:parameter Name="original_CX_Vote_id" Type="Decimal" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:parameter Name="CX_Vote_Name" Type="String" />
            <asp:parameter Name="CX_Vote_LX" Type="Int32" />
            <asp:parameter Name="CX_Vote_Sort" Type="Int32" />
            <asp:parameter Name="CX_Vote_PublicTime" Type="DateTime" />
            <asp:parameter Name="original_CX_Vote_id" Type="Decimal" />
            <asp:parameter Name="original_CX_Vote_Name" Type="String" />
            <asp:parameter Name="original_CX_Vote_LX" Type="Int32" />
            <asp:parameter Name="original_CX_Vote_Sort" Type="Int32" />
            <asp:parameter Name="original_CX_Vote_PublicTime" Type="DateTime" />
        </UpdateParameters>
        <InsertParameters>
            <asp:parameter Name="CX_Vote_Name" Type="String" />
            <asp:parameter Name="CX_Vote_LX" Type="Int32" />
            <asp:parameter Name="CX_Vote_Sort" Type="Int32" />
            <asp:parameter Name="CX_Vote_PublicTime" Type="DateTime" />
        </InsertParameters>
                    </asp:SqlDataSource>
    <table align="center" border="0" cellpadding="2" cellspacing="1" class="border"
        height="116" width="100%">
        <tr>
            <td align="center" class="topbg" colspan="2" style="height: 30px">

                操作</td>
        </tr>
        <tr>
            <td class="tdbg" style="width: 70%; height: 27px">
                <asp:GridView ID="GridView1" runat="server" BackColor="#669900"  Width="100%"
                    BorderColor="#336666" BorderStyle="Double" BorderWidth="3px" CellPadding="4" 
                    GridLines="Horizontal" AutoGenerateColumns="False" 
                    DataKeyNames="CX_Vote_id" DataSourceID="SqlDataSource2" AllowPaging="True">
                    <FooterStyle BackColor="White" ForeColor="#333333" />
                    <RowStyle BackColor="White" ForeColor="#333333" />
                    <columns>
                        <asp:boundfield DataField="CX_Vote_id" HeaderText="编号" InsertVisible="False" 
                            ReadOnly="True" SortExpression="CX_Vote_id">
                        <headerstyle height="30px" />
                        <itemstyle height="27px" />
                        </asp:boundfield>
                        <asp:boundfield DataField="CX_Vote_Name" HeaderText="标题" 
                            SortExpression="CX_Vote_Name"></asp:boundfield>
                        <asp:boundfield DataField="CX_Vote_LX" HeaderText="票数" 
                            SortExpression="CX_Vote_LX"></asp:boundfield>
                        <asp:boundfield DataField="CX_Vote_Sort" HeaderText="排序号" 
                            SortExpression="CX_Vote_Sort"></asp:boundfield>
                        <asp:boundfield DataField="CX_Vote_PublicTime" HeaderText="发布时间" 
                            SortExpression="CX_Vote_PublicTime"></asp:boundfield>
                        <asp:templatefield ShowHeader="False">
                            <itemtemplate>
                                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                    CommandName="Select" Text="编   辑"></asp:LinkButton>
                            </itemtemplate>
                        </asp:templatefield>
                        <asp:templatefield ShowHeader="False">
                            <itemtemplate>
                                <asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                                    CommandName="Delete" Text="删除"></asp:LinkButton>
                            </itemtemplate>
                        </asp:templatefield>
                    </columns>
                    <PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
                </asp:GridView>
            </td>
            <td class="tdbg" style="width: 30%; height: 27px">
                <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
                    BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" 
                    CellPadding="3" DataKeyNames="CX_Vote_id" DataSourceID="SqlDataSource1" 
                    Height="50px" Width="100%" DefaultMode="Edit" HorizontalAlign="Left" 
                    onitemupdated="DetailsView1_ItemUpdated">
                    <FooterStyle BackColor="White" ForeColor="#000066" />
                    <rowstyle forecolor="#000066" />
                    <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                    <fields>
                        <asp:templatefield HeaderText="编号" InsertVisible="False" 
                            SortExpression="CX_Vote_id">
                            <edititemtemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# Eval("CX_Vote_id") %>'></asp:Label>
                            </edititemtemplate>
                            <itemtemplate>
                                <asp:Label ID="Label2" runat="server" Text='<%# Bind("CX_Vote_id") %>'></asp:Label>
                            </itemtemplate>
                            <headerstyle height="30px" />
                        </asp:templatefield>
                        <asp:boundfield DataField="CX_Vote_Name" HeaderText="标题" 
                            SortExpression="CX_Vote_Name"></asp:boundfield>
                        <asp:boundfield DataField="CX_Vote_LX" HeaderText="票数" 
                            SortExpression="CX_Vote_LX"></asp:boundfield>
                        <asp:boundfield DataField="CX_Vote_Sort" HeaderText="排序" 
                            SortExpression="CX_Vote_Sort"></asp:boundfield>
                        <asp:templatefield HeaderText="发布时间" SortExpression="CX_Vote_PublicTime">
                            <edititemtemplate>
                                <asp:TextBox ID="TextBox1" runat="server" 
                                    Text='<%#DateTime.Now.ToString() %>'></asp:TextBox>
                            </edititemtemplate>
                            <insertitemtemplate>
                                <asp:TextBox ID="TextBox1" runat="server" 
                                    Text='<%#DateTime.Now.ToString() %>'></asp:TextBox>
                            </insertitemtemplate>
                            <itemtemplate>
                                <asp:Label ID="Label1" runat="server" Text='<%# Bind("CX_Vote_PublicTime") %>'></asp:Label>
                            </itemtemplate>
                        </asp:templatefield>
                        <asp:templatefield ShowHeader="False">
                            <edititemtemplate>

   
                                <asp:Button ID="Button2" runat="server"  runat="server" CausesValidation="True" 
                                    CommandName="Update" Text="更新数据" CssClass="btn" />
     
                            </edititemtemplate>
                            <itemtemplate>
                                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                    CommandName="Edit" Text="Edit"></asp:LinkButton>
                            </itemtemplate>
                            <itemstyle horizontalalign="Center" verticalalign="Middle" />
                        </asp:templatefield>
                    </fields>
                    <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
                </asp:DetailsView>
            </td>
        </tr>
    </table>
</asp:Content>

